package com.sairobo.admin.modules.srblive.controller;

import java.util.Map;

import com.sairobo.admin.modules.srblive.service.SrbliveLiveroomtypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.sairobo.base.modules.sys.controller.AbstractController;
import com.sairobo.base.common.entity.Page;
import com.sairobo.base.common.entity.R;
import com.sairobo.base.common.annotation.SysLog;

import com.sairobo.admin.modules.srblive.entity.SrbliveLiveroomtype;

/**
 * 直播间类型
 *
 * @author admin
 * @email sairobo
 * @url www.sairobo.com
 * @date 2018年1月11日 下午8:04:39
 */
@RestController
@RequestMapping("/srblive/liveroomtype")
public class SrbliveLiveroomtypeController extends AbstractController {
	
	@Autowired
	private SrbliveLiveroomtypeService srbliveLiveroomtypeService;
	
	/**
	 * 列表
	 * @param params
	 * @return
	 */
	@RequestMapping("/list")
	public Page<SrbliveLiveroomtype> list(@RequestBody Map<String, Object> params) {
		return srbliveLiveroomtypeService.listSrbliveLiveroomtype(params);
	}
		
	/**
	 * 新增
	 * @param srbliveLiveroomtype
	 * @return
	 */
	@SysLog("新增直播间类型")
	@RequestMapping("/save")
	public R save(@RequestBody SrbliveLiveroomtype srbliveLiveroomtype) {
		return srbliveLiveroomtypeService.saveSrbliveLiveroomtype(srbliveLiveroomtype);
	}
	
	/**
	 * 根据id查询详情
	 * @param id
	 * @return
	 */
	@RequestMapping("/info")
	public R getById(@RequestBody Long id) {
		return srbliveLiveroomtypeService.getSrbliveLiveroomtypeById(id);
	}
	
	/**
	 * 修改
	 * @param srbliveLiveroomtype
	 * @return
	 */
	@SysLog("修改直播间类型")
	@RequestMapping("/update")
	public R update(@RequestBody SrbliveLiveroomtype srbliveLiveroomtype) {
		return srbliveLiveroomtypeService.updateSrbliveLiveroomtype(srbliveLiveroomtype);
	}
	
	/**
	 * 删除
	 * @param id
	 * @return
	 */
	@SysLog("删除直播间类型")
	@RequestMapping("/remove")
	public R batchRemove(@RequestBody Long[] id) {
		return srbliveLiveroomtypeService.batchRemove(id);
	}



    /**
     * 根据父类型获取子类型
     * @param pid
     * @return
     */
    @SysLog("根据父类型获取子类型")
    @RequestMapping("/getSonTypes")
    public R getSonTypes(@RequestParam Long pid) {
        return srbliveLiveroomtypeService.getSonTypes(pid);
    }
}
